<!DOCTYPE html>
<html>

	<head>
		<meta http-equiv="content-type" content="text/html; charset=utf-8" />
		<meta content="telephone=no" name="format-detection" />
		<meta name="viewport" content="width=device-width,initial-scale=1,maximum-scale=1.0,user-scalable=no,viewport-fit=cover" />

		<meta charset="utf-8">
		<script type="text/javascript" src="js/boot.js"></script>
		<script type="text/javascript" src="js/base64.min.js"></script>
		<title>个人中心</title>
	</head>

	<body>
		<div id="page" style="background-color: #fff;">
			<div class="header">
				<div class="header-top">
					<div>
						<img class="head-img" :src="weixin.headimgUrl" />
						<div class="head-name">
							{{user.userName}}
						</div>
					</div>
					<div class="head-number">
						工号：{{user.workNo}}
					</div>
				</div>
				<div class="head-bottom">
					<div class="balance">
						<img src="image/7_zhye.png" /> 账户余额
					</div>
					<div class="balance-num">
						<span>{{money}}</span>元
					</div>
				</div>
			</div>
			<div style="height: 0.1rem;background-color: #efeff4;"></div>
			<div class="aui-course-list">
				<a href="javascript:http.gotoHtml('/weixin/3-1-1-recharge.html');" class="aui-flex">
					<div class="aui-cou-img">
						<img src="images/icon-fl-001.png" alt="">
					</div>
					<div class="aui-flex-box">
						<h2>饭卡冲值</h2>
					</div>
				</a>
				<div style="height: 0.1rem;background-color: #efeff4;"></div>
				<a href="javascript:http.gotoHtml('/weixin/3-2-capitalFlow.html');" class="aui-flex b-line">
					<div class="aui-cou-img">
						<img src="images/icon-fl-004.png" alt="">
					</div>
					<div class="aui-flex-box">
						<h2>消费记录</h2>
					</div>
				</a>
				<div style="height: 0.1rem;background-color: #efeff4;"></div>
				<a href="javascript:http.gotoHtml('/weixin/3-3-userCert.html');" class="aui-flex b-line">
					<div class="aui-cou-img">
						<img src="images/icon-fl-002.png" alt="">
					</div>
					<div class="aui-flex-box">
						<h2>身份证件</h2>
					</div>
				</a>
				<div style="height: 0.1rem;background-color: #efeff4;"></div>
				<a href="javascript:;" class="aui-flex b-line">
					<div class="aui-cou-img">
						<img src="images/icon-fl-003.png" alt="">
					</div>
					<div class="aui-flex-box">
						<h2>考勤记录</h2>
					</div>
				</a>
				<div style="height: 0.1rem;background-color: #efeff4;"></div>
			</div>
		</div>
	</body>

	<script type="text/javascript">
		var openId = localStorage.getItem('openId');
		var str = localStorage.getItem('user');
		var user = JSON.parse(str);
		str = localStorage.getItem('weixinUser');
		var weixinUser = {};
		if(str == null || str == "null") {
			http.getSync("/weixin/user/get.do?openId=" + openId, function(page) {
				if(page.success) {
					weixinUser = page.data;
					localStorage.setItem('weixinUser', JSON.stringify(weixinUser));
				} else {
					alert(page.message);
				}
			});
		} else {
			weixinUser = JSON.parse(str);
		}
		// 微信呢称可能有特殊字符，需要64位编码处理
		weixinUser.nickname = Base64.decode(weixinUser.nickname);

		new Vue({
			el: '#page',
			data: {
				weixin: weixinUser,
				user: user,
				money: 0
			},
			methods: {
				onLoad() {}
			},
			created() {
				var data = {
					"userNo": user.workNo,
					"userName": user.userName
				};
				var that = this;
				http.post("/scmain/getAccount.do", data, function(page) {
					if(page.success) {
						that.money = page.data.acMoney / 100;
					} else {
						alert(page.message);
					}
				});
			}
		});
	</script>

</html>